package com.shelpe.services.scheduler.item.adgroup;

import java.util.List;

import org.springframework.batch.item.ItemWriter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.shelpe.services.scheduler.po.Adgroups;
import com.shelpe.services.scheduler.repository.AdgroupsRepository;

@Component("adgroupWriter")
public class AdgroupWriterImpl implements ItemWriter<Adgroups>{
	
	@Autowired
	private AdgroupsRepository adRep;

	@Override
	public void write(List<? extends Adgroups> items) throws Exception {
		// TODO Auto-generated method stub
		if(items != null && items.size() > 0){
			adRep.save(items);
		}
	}

}
